package com.appdatebase;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.HashMap;

import com.appcommon.*;

public class ModifyUserInfo {
	private String sql = 
			"update studentinfo set stuId = ?, stuName = ?, stuSex = ?, stuFrom = ?, stuBir = ?, stuStatus = ?, stuColloge = ?, stuClass = ? where stuId = ?;";
	
	
	public ModifyUserInfo(HashMap<String, String> infoMap) {
		ConnectDataBase dataBase = new ConnectDataBase("studentinfo");
		dataBase.connect();
		Connection connection = dataBase.getConnection();
		try {
			PreparedStatement statement = connection.prepareStatement(sql);
			
			statement.setString(1, infoMap.get("stuId"));
			statement.setString(2, infoMap.get("stuName"));
			statement.setString(3, infoMap.get("stuSex"));
			statement.setString(4, infoMap.get("stuFrom"));
			statement.setString(5, infoMap.get("stuBir"));
			statement.setString(6, infoMap.get("stuStatus"));
			statement.setString(7, infoMap.get("stuColloge"));
			statement.setString(8, infoMap.get("stuClass"));
			statement.setString(9, infoMap.get("stuId"));
			statement.executeUpdate();
			connection.close();
			statement.close();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		dataBase.close();
	}
}
